how to solve nonlinear system